﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.RetailRates
{
    public class RetailRateBranchIdSpecification : Specification<RetailRate>
    {
        #region public properties

        public Guid BranchId
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public RetailRateBranchIdSpecification(Guid retailRateBranchId)
        {
            this.BranchId = retailRateBranchId;
        }

        #endregion

        #region public methods

        public override Expression<Func<RetailRate, bool>> SatisfiedBy()
        {
            Specification<RetailRate> spec = new TrueSpecification<RetailRate>();
            spec &= new DirectSpecification<RetailRate>(c => c.BranchId == this.BranchId);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
